#ifndef TICK_H
#define TICK_H

#include <peripheral/ports.h>
#include <peripheral/uart.h>
#include <peripheral/system.h>
#include <peripheral/int.h>
#include <peripheral/timer.h>
#include "task.h"

/*
	 Returns the current number of ticks.
*/
unsigned int getTickCount (void);

/*
	 Supposed to trigger a software interrupt
*/
void forceContextSwitch (void);

/*
	 Give me the status register from coprocessor 0
*/
unsigned int getStatusRegister (void);

/*
	 set and retrieve pointer to the current running task
*/
void setRunningTask (struct task *task);
struct task *getRunningTask (void);

void __attribute__ ((interrupt (ipl1), vector (_TIMER_1_VECTOR))) hwtick (void);
void __attribute__ ((interrupt (ipl1), vector (_CORE_SOFTWARE_0_VECTOR))) swtick (void);
#endif

